using System;
using System.Drawing;
using System.Windows.Forms;
using Diagram.Model;
using Diagram.Tools;
using Diagram.View;
using PetriDiagram.Model;

namespace PetriDiagram.Tools
{
    [Serializable]
    public class TokenTool : Tool
    {
        protected Cursor cursor;

        public TokenTool( EntityManager entityManager, Diagram.View.Diagram diagram )
            : base( entityManager, diagram )
        { }

        public override void OnMouseMove( Point location )
        {
            Shape shape = Diagram.FindShape( location );

            if( shape != null && ( shape.Entity is Place || shape.Entity is PetriNetRelation ) )
                cursor = Cursors.Hand;
            else
                cursor = Cursors.Cross;

            Cursor.Current = cursor;
            base.OnMouseMove( location );
        }

        public override Cursor Cursor
        {
            get
            {
                return cursor;
            }
        }
    }
}